<template>
  <el-form :inline="true" :model="formInline" :rules="rule" ref="form" class="demo-form-inline">
    <el-form-item label="活动名称" prop="name">
      <el-input :value="name" @input="changeQName" placeholder="活动名称"></el-input>
    </el-form-item>
   
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import { mapMutations, mapGetters } from "vuex";

export default {
  name: "g2ExampleTableQuery",
  props: {},
  components: {},
  data() {
    return {
      query: {
        name: "121",
        status: []
      },
      rule: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ]
      }
    };
  },
  computed: {
    ...mapGetters("examples/table", {
      formInline: "g_query",
      name: "g_name",
      status: "g_status"
    })
  },
  methods: {
    ...mapMutations("examples/table", {
      changeQName: "s_qname",
      changeQStatus: "s_qStatus"
    }),
    
    onSubmit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    }
  }
};
</script>

<style scoped lang="scss">
</style>
